#include <stdint.h>

// Sizes
#define FRAME_LENGTH 160
#define SEGMENT_LENGTH 40

#ifndef DEFINES_H
#define DEFINES_H
// Tables used in fixed point implementation

//Quantization of Log-Area Ratios
extern const int16_t table_A[];
extern const int16_t table_B[];
extern const int16_t table_MIC[];
extern const int16_t table_MAC[];

extern const int16_t table_INVA[];

extern const int16_t table_DLB[];

extern const int16_t table_QLB[];

extern const int16_t table_H[];

// TODO check table types

extern const int16_t table_FAC[];

extern const int16_t table_NRFAC[];

// TODO comment every table
#endif // DEFINES_H

// Function macros
#define get_first_bits(x,total,sbits) ( ( (x) & (((1<<(total))-1) - ((1<<((total)-(sbits)))-1)) ) >>((total)-(sbits)) )
#define get_last_bits(x,sbits)  ( (x) & ( ((1<<(sbits)) - 1) ) )
#define get_byte_mask(start,end) ( ((1<<((start)+1))-1) - ((1<<(end))-1) )
#define get_bit_range(x, start, end) ( ( (x) & get_byte_mask(start,end) ) >> (end) )

